package com.ma.netana.pojo;

import java.io.Serializable;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class IPv6Option implements Serializable {
    private static final long serialVersionUID = 4027393032973499183L;
    public static final byte HOP_BY_HOP_OPTION = 0;
    public static final byte ROUTING_OPTION = 43;
    public static final byte FRAGMENT_OPTION = 44;
    public static final byte ESP_OPTION = 50;
    public static final byte AH_OPTION = 51;
    public static final byte NONE_OPTION = 59;
    public static final byte DESTINATION_OPTION = 60;
    public byte type;
    public byte next_header;
    public byte hlen;
    public byte[] option;
    public byte routing_type;
    public byte hop_left;
    public InetAddress[] addrs;
    public short offset;
    public boolean m_flag;
    public int identification;
    public int spi;
    public int sequence;

    public IPv6Option() {
    }

    void setValue(byte type, byte next, byte hlen) {
        this.type = type;
        this.next_header = next;
        this.hlen = hlen;
    }

    void setOptionData(byte[] option) {
        this.option = option;
    }

    void setRoutingOption(byte type, byte left, byte[][] addrs) {
        this.routing_type = type;
        this.hop_left = left;
        this.addrs = new InetAddress[addrs.length];

        for(int i = 0; i < addrs.length; ++i) {
            try {
                this.addrs[i] = InetAddress.getByAddress(addrs[i]);
            } catch (UnknownHostException var6) {
            }
        }

    }

    void setFragmentOption(short offset, boolean m, int ident) {
        this.offset = offset;
        this.m_flag = m;
        this.identification = ident;
    }

    void setAHOption(int spi, int seq) {
        this.spi = spi;
        this.sequence = seq;
    }
}

